#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    priority_queue<pii, vector<pii>, less<pii>> pq;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<char> ans(n);
    int t = 0;
    for(int i = 0; i < n; i++) {
        if(t == 0) {
            if(pq.size() && pq.top().first > a[i]) {
                ans[pq.top().second] = '(';
                pq.pop();
                pq.push({a[i], i});
                ans[i] = ')';
            }else ans[i] = '(';
            t++;
        }else{
            ans[i] = ')';
            pq.push({a[i], i});
            t--;
        }
    }
    for(auto x : ans) cout << x;
    cout << endl;
}

signed main() {
    int t = 1;
    cin >> t;
    while(t--) solve();
    return 0;
}